import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import '@/assets/iconfont/iconfont.js'

import ElementUI from 'element-ui'
import '@/styles/element-variables.scss'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

// 全局注册自定义组件
import componentPlugin from '@/components/index'
Vue.use(componentPlugin)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
}

// 导入中文
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
Vue.use(ElementUI, {
  locale: zhLocale
})
zhLocale.el.pagination = {
  goto: '前往{goto}',
  pagesize: '条/页',
  total: `共计 {total} 条`,
  pageClassifier: '页'
}

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
